//
//  BottomCollectionViewCell.swift
//  RoundCatPlay2
//
//  Created by 姜澎 on 2019/10/22.
//  Copyright © 2019 jiangpeng. All rights reserved.
//

import UIKit
import SnapKit
class BottomCollectionViewCell: UICollectionViewCell {
    
    public var DwLable:UILabel = {     // interface
        var l = UILabel()
        l.text = "尊贵铂金"
        l.textColor = UIColor.white
        l.font = UIFont.systemFont(ofSize: 10)
        
        return l
    }()
    
    private var nameLable:UILabel = {     // interface
        var l = UILabel()
        l.text = "周二珂"
        l.font = UIFont.systemFont(ofSize: 14)
        return l
    }()
    
    private var gxLabelOne:UILabel = {  // interface
        var l = UILabel()
        l.text = "美丽"
        l.font = UIFont.systemFont(ofSize: 10)
        l.layer.cornerRadius = 10
        l.clipsToBounds = true
        l.textAlignment = .center
        l.textColor = UIColor(red: 72/255, green: 92/255, blue: 234/255, alpha: 1)
        l.backgroundColor = UIColor(red: 212/255, green: 216/255, blue: 250/255, alpha: 1)
        return l
    }()
    
    private var gxLabeltwo:UILabel = {  // interface
        var l = UILabel()
        l.text = "娃娃音"
        l.font = UIFont.systemFont(ofSize: 10)
        l.layer.cornerRadius = 10
        l.clipsToBounds = true
        l.textAlignment = .center
        l.textColor = UIColor(red: 72/255, green: 92/255, blue: 234/255, alpha: 1)
        l.backgroundColor = UIColor(red: 212/255, green: 216/255, blue: 250/255, alpha: 1)
        return l
    }()
    
    private var moneyLable: UILabel = {  // interface
        let l = UILabel()
        l.text = "¥ 8元"
        l.textColor = UIColor(red: 253/255, green: 160/255, blue: 42/255, alpha: 1)
        l.font = UIFont.systemFont(ofSize: 14)
        return l
    }()
    
    private var qiLable: UILabel = {
        var l = UILabel()
        l.text = "起"
        l.textColor = UIColor(red: 136/255, green: 136/255, blue: 136/255, alpha: 1)
        l.font = UIFont.systemFont(ofSize: 11)
        return l
    }()
    
    private var addressImag: UIImageView = {
        var a = UIImageView()
        a.image = UIImage(named: "定位")
        return a
    }()
    
    private var addressName: UILabel = {      // interface
        var l = UILabel()
        l.text = "北京"
        l.textColor = UIColor(red: 136/255, green: 136/255, blue: 136/255, alpha: 1)
        l.font = UIFont.systemFont(ofSize: 11)
        return l
    }()
    
    private var radioBtu :UIButton = {
        var btu = UIButton(type: .custom)
        btu.setImage(UIImage(named: "radio"), for: .normal)
        btu.setImage(UIImage(named: "radio"), for: .selected)
        return btu
    }()
    
    private lazy var allView:UIView = {
        var a = UIView()
       
        addSubview(self.imageView)
        addSubview(self.rightView)
        addSubview(self.imageBottomV)
        addSubview(self.nameLable)
        addSubview(self.gxLabelOne)
        addSubview(self.gxLabeltwo)
        addSubview(self.moneyLable)
        addSubview(self.qiLable)
        addSubview(self.addressImag)
        addSubview(self.addressName)
        addSubview(self.radioBtu)
        layer.cornerRadius = 10
        clipsToBounds = true
        backgroundColor = UIColor.white
        
        return a
    }()
//    titleImage
    private lazy var imageView:UIImageView = {      // interface
        var i = UIImageView()
        i.image = UIImage(named: "titileImage")
        return i
    }()
//  求单ing
    private lazy var rightView:UIImageView = {
        var v = UIImageView()
        v.image = UIImage(named: "求单")
        return v
    }()
    
//    iamgeBottomView
    private lazy var imageBottomV:UIImageView = {
        var v = UIImageView()
        v.addSubview(self.DwLable)
        v.image = UIImage(named: "bottomIm")
        return v
    }()

    override init(frame: CGRect) {
        super.init(frame: frame)
        addSubview(self.allView)
        setUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
}

extension BottomCollectionViewCell {
    func setUI() {
        self.allView.snp.makeConstraints { (make) in
            make.top.equalTo(0)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.equalTo(240)
        }
        self.imageView.snp.makeConstraints { (make) in
            make.top.equalTo(0)
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.equalTo(150)
        }
        
        self.rightView.snp.makeConstraints { (make) in
            make.top.equalTo(10)
            make.right.equalTo(10)
            make.height.equalTo(25)
            make.width.equalTo(70)
        }
        
        self.imageBottomV.snp.makeConstraints { (make) in
            make.left.equalTo(0)
            make.right.equalTo(0)
            make.height.equalTo(25)
            make.bottom.equalTo(imageView.snp_bottom)
        }
        self.DwLable.snp.makeConstraints { (make) in
            make.left.equalTo(10)
            make.centerX.equalTo(imageBottomV.snp_centerX)
            make.width.equalTo(50)
            make.height.equalTo(25)
        }
        self.nameLable.snp.makeConstraints { (make) in
            make.top.equalTo(self.imageView.snp_bottom).offset(10)
            make.left.equalTo(10)
            make.width.equalTo(45)
            make.height.equalTo(10)
        }
        self.gxLabelOne.snp.makeConstraints { (make) in
            make.top.equalTo(self.imageView.snp_bottom).offset(5)
            make.width.equalTo(gxLabeltwo.snp_width)
            make.height.equalTo(20)
            make.left.equalTo(self.nameLable.snp_right).offset(5)
            make.right.equalTo(self.gxLabeltwo.snp_left).offset(-5)
        }
        self.gxLabeltwo.snp.makeConstraints { (make) in
            make.top.equalTo(self.imageView.snp_bottom).offset(5)
            make.height.equalTo(20)
            make.right.equalTo(-20)
            make.left.equalTo(self.gxLabelOne.snp_right).offset(5)
        }
        
        self.moneyLable.snp.makeConstraints { (make) in
            
            make.left.equalTo(10)
            make.bottom.equalTo(-10)
            make.width.equalTo(40)
        }
        
        self.qiLable.snp.makeConstraints { (make) in
            make.left.equalTo(self.moneyLable.snp_right).offset(0)
            make.width.equalTo(20)
            make.height.equalTo(20)
            make.centerY.equalTo(self.moneyLable.snp_centerY)
        }
        
        self.addressImag.snp.makeConstraints { (make) in
            make.width.equalTo(10)
            make.height.equalTo(15)
            make.right.equalTo(-30)
            make.bottom.equalTo(-10)
        }
        
        self.addressName.snp.makeConstraints { (make) in
            make.width.equalTo(30)
            make.height.equalTo(20)
            make.centerY.equalTo(self.addressImag.snp_centerY)
            make.left.equalTo(addressImag.snp.right).offset(2)
            make.right.equalTo(-5)
        }
        
        self.radioBtu.snp.makeConstraints { (make) in
            make.top.equalTo(nameLable.snp_bottom).offset(10)
            make.left.equalTo(10)
            make.width.equalTo(100)
            make.height.equalTo(30)
            make.right.equalTo(-40)
        }
    }
}
